


public class NaiveMove implements MoveRule 
{

	@Override
	public boolean isLegalMove(Board board, Move move, Move.Direction direction) 
	{
//		Move pusherMove = move.doNewMove( direction.reverse() );
//		
//        switch ( board.getCellType(pusherMove) ) 
//        {
//	        case Wall: 				return false;
//	        case Player: break;
//	        case PlayerOnGoalSquare: break;
//	        case Box: 				return false;
//	        case BoxOnGoal: 		return false;
//	        case GoalSquare: break;
//	        case EmptyFloor: break;
//	        	
//	        default: throw new IllegalArgumentException();
//        }
        
        switch ( board.getCellType(move) ) 
        {
	        case Wall: 				return false;
	        
//	        case Player: throw new RuntimeException("Bug i olles regel:3");
//	        case PlayerOnGoalSquare: throw new RuntimeException("Bug i olles regel:4");
	        case Player: break;
	        case PlayerOnGoalSquare: break;
	        case GoalSquare: break;
	        case EmptyFloor: break;
	        
	        case Box: 
	        case BoxOnGoal:
	        
		        Move boxMove = move.doNewMove( direction );
		        switch ( board.getCellType(boxMove) ) 
		        {
			        case Wall: 				return false;
			        
			        case Player: throw new RuntimeException("Bug i olles regel:1");
			        case PlayerOnGoalSquare: throw new RuntimeException("Bug i olles regel:2");
			        case GoalSquare: break;
			        case EmptyFloor: break;
			        
			        case Box: 				return false;
			        case BoxOnGoal: 		return false;
	
			        	
			        default: throw new IllegalArgumentException();
		        }
		    break;
	       
	        	
	        default: throw new IllegalArgumentException();
        }
        
        return true;
	}

}
